package dem1;

import java.util.Arrays;

/**
 * Created with Intellij IDEA.
 * Description:
 * User: 33013
 * Date: 2023-05-05
 * Time: 19:09
 */
public class Test {

    public static void shellSort(int[] array){
        int length = array.length;
        while (length > 1){
            length = length / 2;
            shell(array, length);
        }
    }

    public static void shell(int[] array, int gap){
        for(int i = gap; i < array.length; i++){
            int j = i - gap;
            int tmp = array[i];
            for (; j >= 0; j -= gap){
                if (array[j] > tmp){
                    array[j + gap] = array[j];
                }else {
                    break;
                }
            }
            array[j + gap] = tmp;
        }
    }

    public static void selectSort(int[] array) {
        for (int i = 0; i < array.length - 1; i++) {
            int minindex = i;
            for (int j = i + 1; j < array.length; j++) {
                if (array[minindex] > array[j]){
                    minindex = j;
                }
            }
            int tmp = array[i];
            array[i] = array[minindex];
            array[minindex] = tmp;
        }
    }
    public static void main(String[] args) {
//        int[] arr = {4,7,1,4,9,3,2,8,12,3,4,0,1};
//        selectSort(arr);
//        System.out.println(Arrays.toString(arr));
//        int i=0;
//        Integer j = new Integer(0);
//        System.out.println(i==j);
//        System.out.println(j.equals(i));

        int[] arr = {10,20,8,25,35,6,18,30,5,15,28};
        shell(arr,5);
        System.out.println(Arrays.toString(arr));
        Object o=new Object(){
            public boolean equals(Object obj){
                return true;
            }
        };
        System.out.println(o.equals("faee"));
    }
}
